/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Caps
 */
@Entity
@Table(name = "docente")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Docente.findAll", query = "SELECT d FROM Docente d"),
    @NamedQuery(name = "Docente.findByPssfscCodigo", query = "SELECT d FROM Docente d WHERE d.pssfscCodigo = :pssfscCodigo"),
    @NamedQuery(name = "Docente.findByPssfscNome", query = "SELECT d FROM Docente d WHERE d.pssfscNome = :pssfscNome"),
    @NamedQuery(name = "Docente.findByPssfscEmail", query = "SELECT d FROM Docente d WHERE d.pssfscEmail = :pssfscEmail")})
public class Docente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "pssfsc_codigo")
    private Integer pssfscCodigo;
    @Size(max = 2147483647)
    @Column(name = "pssfsc_nome")
    private String pssfscNome;
    @Size(max = 2147483647)
    @Column(name = "pssfsc_email")
    private String pssfscEmail;
    @JoinTable(name = "turma_docente", joinColumns = {
        @JoinColumn(name = "pssfsc_cdgdocente", referencedColumnName = "pssfsc_codigo")}, inverseJoinColumns = {
        @JoinColumn(name = "prdltv_prdletivo", referencedColumnName = "prdltv_prdletivo"),
        @JoinColumn(name = "crs_codigo", referencedColumnName = "crs_codigo"),
        @JoinColumn(name = "dsc_codigo", referencedColumnName = "dsc_codigo"),
        @JoinColumn(name = "trmcbc_serie", referencedColumnName = "trmcbc_serie"),
        @JoinColumn(name = "trmcbc_sequencia", referencedColumnName = "trmcbc_sequencia"),
        @JoinColumn(name = "trm_codigo", referencedColumnName = "trm_codigo")})
    @ManyToMany
    private List<Turma> turmaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "docente")
    private List<DiretorCentro> diretorCentroList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "docente")
    private List<CoordenadorCurso> coordenadorCursoList;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "docente")
    private Login login;
    @JoinColumn(name = "str_lotacao", referencedColumnName = "str_codigo")
    @ManyToOne(optional = false)
    private Setor strLotacao;

    public Docente() {
    }

    public Docente(Integer pssfscCodigo) {
        this.pssfscCodigo = pssfscCodigo;
    }

    public Integer getPssfscCodigo() {
        return pssfscCodigo;
    }

    public void setPssfscCodigo(Integer pssfscCodigo) {
        this.pssfscCodigo = pssfscCodigo;
    }

    public String getPssfscNome() {
        return pssfscNome;
    }

    public void setPssfscNome(String pssfscNome) {
        this.pssfscNome = pssfscNome;
    }

    public String getPssfscEmail() {
        return pssfscEmail;
    }

    public void setPssfscEmail(String pssfscEmail) {
        this.pssfscEmail = pssfscEmail;
    }

    @XmlTransient
    public List<Turma> getTurmaList() {
        return turmaList;
    }

    public void setTurmaList(List<Turma> turmaList) {
        this.turmaList = turmaList;
    }

    @XmlTransient
    public List<DiretorCentro> getDiretorCentroList() {
        return diretorCentroList;
    }

    public void setDiretorCentroList(List<DiretorCentro> diretorCentroList) {
        this.diretorCentroList = diretorCentroList;
    }

    @XmlTransient
    public List<CoordenadorCurso> getCoordenadorCursoList() {
        return coordenadorCursoList;
    }

    public void setCoordenadorCursoList(List<CoordenadorCurso> coordenadorCursoList) {
        this.coordenadorCursoList = coordenadorCursoList;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

    public Setor getStrLotacao() {
        return strLotacao;
    }

    public void setStrLotacao(Setor strLotacao) {
        this.strLotacao = strLotacao;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pssfscCodigo != null ? pssfscCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Docente)) {
            return false;
        }
        Docente other = (Docente) object;
        if ((this.pssfscCodigo == null && other.pssfscCodigo != null) || (this.pssfscCodigo != null && !this.pssfscCodigo.equals(other.pssfscCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return pssfscNome;
    }
    
}
